import { financialProductAxios } from '@/utils/request.ts'
import { downloadBlobFile } from '@hs-admin/api'

// 资本趋势
export const getFinancingTrend = (data) => {
  return financialProductAxios(
    {
      url: '/be-cyzz-enterprise-figure/capital/search/financingTrend',
      method: 'post',
      data
    },
    {
      extra_handle_response: true
    }
  )
}

// 资本明细
export const getFinancingDetailsPage = (data) => {
  return financialProductAxios(
    {
      url: '/be-cyzz-enterprise-figure/capital/search/financingDetailsPage',
      method: 'post',
      data
    },
    {
      extra_handle_response: true
    }
  )
}

// 融资轮次
export const getFinancingRoundsRequest = (data) => {
  return financialProductAxios(
    {
      url: '/be-cyzz-enterprise-figure/capital/search/financeRoundList',
      method: 'post',
      data
    },
    {
      extra_handle_response: true
    }
  )
}

// 融资导出
export const exportFinancingToLocal = (data, name) => {
  return financialProductAxios({
    url: `/be-cyzz-enterprise-figure/capital/search/export`,
    method: 'post',
    responseType: 'blob',
    data
  }).then((res: any) => {
    downloadBlobFile(res, `${name}.xlsx`)
  })
}

// 市场趋势
export const getMarketTrend = (data) => {
  return financialProductAxios(
    {
      url: '/be-cyzz-enterprise-figure/market/search/trend',
      method: 'post',
      data
    },
    {
      extra_handle_response: true
    }
  )
}

// 市场明细
export const getMarketDetailsPage = (data) => {
  return financialProductAxios(
    {
      url: '/be-cyzz-enterprise-figure/market/search/page',
      method: 'post',
      data
    },
    {
      extra_handle_response: true
    }
  )
}

// 市场导出
export const exportMarketToLocal = (data, name) => {
  return financialProductAxios({
    url: `/be-cyzz-enterprise-figure/market/search/export`,
    method: 'post',
    responseType: 'blob',
    data
  }).then((res: any) => {
    downloadBlobFile(res, `${name}.xlsx`)
  })
}
